-
Notifications
You must be signed in to change notification settings - Fork 23
samples: siwx917_ota: http/s OTAF application #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
466273e to
6a581ad
Compare
569c7b4 to
dd7f3de
Compare
|
Please rebase this on the latest |
6025ad2 to
8cc35e9
Compare
samples/siwx91x_ota/src/main.c
Outdated
| /* Message for HTTP data */ | ||
| typedef struct { | ||
| uint32_t length; | ||
| uint8_t buffer[RECV_BUFFER_SIZE]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RECV_BUFFER_SIZE is an arbitrary value and used only once. Drop the symbols and replace it the value.
| if (app_ctx_st->http_response_error) { | ||
| printf("Error occurred during HTTP download, skipping processing\n"); | ||
| return -EPROTO; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably handled by the caller.
8cc35e9 to
00eb379
Compare
9c620ad to
7fe97ff
Compare
c3b2473 to
4bf41dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I stop here for today.
samples/siwx91x_ota/Kconfig
Outdated
|
|
||
| config OTA_UPDATE_URL | ||
| string "OTA update URL" | ||
| default "http://example.com:8080/firmware.rps" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation talks about HTTPS, but the default value doesn't use it.
samples/siwx91x_ota/README.rst
Outdated
|
|
||
| Application demonstrates how to perform HTTP/HTTPS OTA firmware updates on the | ||
| SiWx917 platform using Zephyr RTOS. It connects to a Wi-Fi network, establishes | ||
| a secure HTTPS connection using a CA certificate, and downloads firmware |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a secure HTTPS connection using a CA certificate
In simple words: an HTTPS connection.
1b8ada9 to
a13421c
Compare
|
|
||
| error: | ||
| if (ctx->sock < 0) { | ||
| zsock_close(ctx->sock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hu? probably you mean if (ctx->sock >= 0)?
In fact, even this test is useless since zsock_close() on negative value will properly catch the error.
samples/siwx91x_ota/src/main.c
Outdated
| ret = zsock_connect(ctx->sock, res->ai_addr, res->ai_addrlen); | ||
| if (ret < 0) { | ||
| printf("Connection failed (%d): %s\n", -errno, strerror(errno)); | ||
| ctx->sock = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hu? you leak the socket ressource.
samples/siwx91x_ota/src/main.c
Outdated
|
|
||
| ret = zsock_getaddrinfo(http_parse_data_info.host, http_parse_data_info.port, NULL, &res); | ||
| if (ret != 0) { | ||
| printf("Address resolution failed: %s\n", zsock_gai_strerror(ret)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the host and the port are easily reachable and provide a useful information, you can provide them:
printf("Cannot resolve %s:%s: %s\n",
http_parse_data_info.host, http_parse_data_info.port,
zsock_gai_strerror(ret));
samples/siwx91x_ota/src/main.c
Outdated
| */ | ||
| static int ota_connect_to_server(struct app_ctx *ctx) | ||
| { | ||
| struct http_parse_data http_parse_data_info = ctx->http_parse_data_info; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data and info are redundant. BTW, why don't you get a pointer rather than duplicating this structure?
struct url_data *url_data = &ctx->url_data;
a13421c to
b2555db
Compare
This application demonstrates the support for OTA firmware upgrade. Signed-off-by: Devika Raju <[email protected]>
b2555db to
4ad0105
Compare
Updating the SiWx917 device's firmware including NWP, M4, and the combined M4 + TA images using an HTTP or HTTPS server. It supports both secure and non-secure firmware updates for all three types: NWP, M4, and the combined image.